home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac 1
/
Ian and Stuart's One (Australia).iso
/
Australasian Legends
/
Commercial
/
Rainbow Hill
/
MacDOS™ 2.0.0
/
batches
/
listErr.bat
< prev
next >
Wrap
DOS Batch File
|
1993-09-26
|
2KB
|
74 lines
@echo off
! listErr.bat Batch file to list all the error messages
!
! listErr [filename]
!
! where 'filename' is the file into which the list is to be stored.
! If the filename is missing, the listing is done on the screen.
! Additional parameters are ignored.
!
! Note that error messages consist of a single line of text.
!
! Copyright © 1993 by Rainbow Hill Pty Ltd. All rights reserved.
!
! initialisation
onerror ERR_LBL
! the maximum is 256, but we do not want to waste time
set maxerr=90
! first check whether the user has provided the filename
! pre-set the fileID to zero which will be used to indicate the monitor
set fileID=0
if "%1 " == " " goto FTEST_DONE_LBL
if exist %1 del %1
open/w "%1" fileID
:FTEST_DONE_LBL
! initialise the error code
set k=1
! loop to obtain, process, and then store all the messages
repeat ERR_LOOP_LBL
! obtain a message
show %k% result
! We have to check the result to ensure that the error code has a message,
! but we only check the first word of the message otherwise we could cause
! a command line overflow.
! Before searching for the first space in the result, we make sure that
! there is one by appending it to the end.
set first_word=%result%
incr first_word by " "
sstr first_word " "
! we have to add something (eg. an @) in order to ensure that it works when
! the first word is the string "not"
if %first_word%@ == %k%@ goto NEXT_ERR_LBL
if %fileID% == 0 goto TO_SCREEN_LBL
write %fileID% "%k%: %result%"
goto NEXT_ERR_LBL
:TO_SCREEN_LBL
echo %k%: %result%
:NEXT_ERR_LBL
! check whether we have processed all the errors
incr k
if %k% == %maxerr% goto X_ERR_LOOP_LBL
:ERR_LOOP_LBL
:X_ERR_LOOP_LBL
! reset doserr so that we can fall through
set doserr=0
:ERR_LBL
if not %doserr% == 0 show %doserr%
:DONE_LBL
if not %fileID% == 0 close %fileID%
set result=
set maxerr=
set k=
set first_word=
set fileID=